#region Using Statements

using System;
using System.Collections.Generic;
using System.Text;
using System.Web.SessionState;

#endregion

namespace Dotss.Core
{

    /// <summary>
    /// This interface describes the methods that a DataAccess layer must provide in order to be consumed by the ServerRO
    /// </summary>
    public interface DataAccess : IDisposable
    {

		/// <summary>
		/// Remove the specified SessionID from the DataStore
		/// </summary>
		/// <param name="sessionId">The ID of the session to remove</param>
		/// <param name="appId">The application to which the session belongs</param>
		/// <param name="envId">The environment to which the session belongs</param>
    	void Remove(string sessionId, string appId, string envId);

		/// <summary>
		/// Reset the timeout on the session specified in the submitted args, using the current time
		/// and the timeout value submitted in the args
		/// </summary>
		/// <param name="args">Parameter collection regarding the current settings around the session to reset</param>
		void ResetTimeout(SessionArgs args);

		/// <summary>
		/// Create a new session with the session information submitted
		/// </summary>
		/// <param name="args">Session information to persist</param>
    	void CreateNew(SessionArgs args);

		/// <summary>
		/// Initialize the data store provider with the configuration args submitted
		/// </summary>
		/// <param name="args">Arguments about the session client to use in configuring the datastore</param>
    	void Initialize(SessionArgs args);

		/// <summary>
		/// Release the lock (if any) on the session specified in the submitted args
		/// </summary>
		/// <param name="args">Information about the session whose lock should be released</param>
    	void ReleaseLock(SessionArgs args);

		/// <summary>
		/// Store the items submitted for the session identified in the args submitted
		/// </summary>
		/// <param name="args">Identifying information about the session data to persist</param>
		/// <param name="items">Session data to store</param>
    	void SetItem(SessionArgs args, byte[] items);

		/// <summary>
		/// Get the session items for the session identified by the args submitted and return various metadata about that session
		/// </summary>
		/// <param name="args">Identifying information about the session to fetch</param>
		/// <param name="isExclusive">Should this be an exclusive fetch, locking out other access to the session?</param>
		/// <param name="locked">Was the session locked successfully?</param>
		/// <param name="lockAge">The age of the lock encountered or created</param>
		/// <param name="lockId">The ID of the lock created (if any)</param>
		/// <param name="actions">The actions the session state should take (if any)</param>
		/// <returns>Byte array ready to be deserialized from the datastore</returns>
    	byte[] GetItem(SessionArgs args, bool isExclusive, out bool locked, out TimeSpan lockAge, out int lockId,
    	               out SessionStateActions actions);

    }

}
